<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            padding-bottom: 800px;
            padding-left: 30px;
        }
        .switch{
            font-size: 36px;
            /* 该样式内部的所有元素大小单位统一使用 em 单位 */
            cursor: pointer;
            user-select: none;
        }
        .text{
            transition:all 150ms ease;
            vertical-align: middle;
        }
        .text.active{
            color: #409eff;
        }
        .pot{
            display: inline-block;
            width: 3em;
            height: 1.5em;
            background-color: #dcdfe6;
            vertical-align: middle;
            margin: 0px 0.4em;
            border-radius:3em;
            transition:all 150ms ease;
            box-shadow: 0 0 0.2em #b1b1b1 inset;
        }
        .pot i{
            display: inline-block;
            width: 1.5em;
            height: 1.5em;
            background-color: white;
            border-radius: 50%;
            transform: scale(0.8);
            transition:all 150ms ease-out;
            box-shadow: 0 0 0.2em #b1b1b1;
        }
        .event{
            display: none;
        }
        .event:checked + .pot{
            background-color: #409eff;
            box-shadow: 0 0 0.2em #2f75bb inset;
        }
        .event:checked + .pot i{
            transform: translate(100%,0) scale(0.8);
            box-shadow: 0 0 0.2em #2f75bb;
        }
    </style>
</head>
<body>
    <div id="app">
        
        <label class="switch" style="font-size: 24px;">
            <span class="text" :class="{ active:!flag }">按年付费</span>
            <input class="event" type="checkbox" :checked="flag" @change="flag=$event.target.checked">
            <span class="pot">
                <i></i>
            </span>
            <span class="text" :class="{ active:flag }">按月付费</span>
        </label>
        
        

    </div>
    <script type="module">
        // 加载 Vue3 的ESM 模块文件
        import { createApp } from "../assets/vue3/vue.esm-browser.js"
        createApp({
            data(){
                return {
                    flag:false
                }
            }
        }).mount("#app")
    </script>
</body>
</html>